﻿<!DOCTYPE HTML>
<html>
<head>
    {include file="common:meta"}
</head>
<body class="gray-bg">
<div class="middle-box text-center loginscreen  animated fadeInDown">
    <div class="row ">
        <div>
            <h1 class="logo-name">酥酥</h1>
        </div>
        <form id="form" data-url="/Login" class="m-t">
            <div class="form-group">
                <input id="username" name="username" class="form-control" type="text" placeholder="账户">
            </div>
            <div class="form-group">
                <input id="password" name="password" class="form-control" type="password" placeholder="密码">
            </div>
        </form>
        <button class="btn btn-primary block full-width m-b" id="DD_submit">登录</button>
    </div>
</div>
{include file="common:footer"}

<script type="text/javascript">
    $("#DD_submit").click(function () {
        var username = $("#username").val();
        var password = $("#password").val();
        $.ajax({
            url: '/Login',
            type: 'POST',
            dataType: 'json',
            data: {'username': username, 'password': password},
            success: function (re) {
                console.log(re);
                if (re.code === 1) {
                    layer.msg(re.msg, {icon: 1});
                    re.url ? window.location.href = re.url : '';
                } else {
                    layer.alert(re.msg);
                }
            }
        });
        return false;
    });

</script>
</body>
</html>